package com.example.exampleproject.utils;

import java.util.HashMap;
import java.util.Map;

public enum SexEnum {
    MALE("男"),FEMALE("女");
    String value;
    private  static Map<String,SexEnum> sexEnumMap = new HashMap<>();
    static {
        for (SexEnum sexEnum : SexEnum.values()) {
            sexEnumMap.put(sexEnum.getValue(),sexEnum);
        }
    }
    //依据key获取枚举
    public static  SexEnum getSexEnumByValue(String value){
        return sexEnumMap.get(value);
    }


   private SexEnum(String value){
       this.value=value;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    @Override
    public String toString() {
        return "SexEnum{" +
                "value='" + value + '\'' +
                '}';
    }
}
